//
//  DSNDialerAppDelegate.m
//  DSNDialer
//
//  Created by Chris Morrell on 4/30/10.
//  Copyright __MyCompanyName__ 2010. All rights reserved.
//

#import "DSNDialerAppDelegate.h"
#import "ConversionViewController.h"

@implementation DSNDialerAppDelegate

@synthesize window;
@synthesize myConversionViewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
	NSString *resourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Recents.plist"];
	
	//Documents directory path
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSString *DataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Recents.plist"];
	
	NSFileManager *fileManager = [NSFileManager defaultManager];
	
	//see if Data.plist exists in the Documents directory
	if (![fileManager fileExistsAtPath:DataPath]) {
		[fileManager copyItemAtPath:resourcePath toPath:DataPath error:nil];
	}
	
	ConversionViewController *newConversionViewController = [[ConversionViewController alloc] initWithNibName:@"ConversionView" bundle:nil];
	self.myConversionViewController = newConversionViewController;
	[newConversionViewController release];
	
	window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"paper_texture.png"]];
	
	[window addSubview:myConversionViewController.view];
	[window makeKeyAndVisible];
	
	[myConversionViewController showSplash];
	

	return YES;
}

- (void)dealloc {
	[myConversionViewController release];
    [window release];
    [super dealloc];
}

@end

